<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('待检测列表修改')"/>
</head>
<style>
	input{
		border-style: none;
		border-bottom-style: solid;
	}
	.input_select span,
	.input_select select {
		display: inline-block;
		vertical-align: middle; /* 垂直居中对齐 */
	}
	input::-webkit-input-placeholder {
		text-align: center;
	}

	input:-moz-placeholder {
		text-align: center;
	}

	input::-moz-placeholder {
		text-align: center;
	}

	input:-ms-input-placeholder {
		text-align: center;
	}
	.input_min {
		width: 80pt;
	}
	.input_max {
		width: 180pt;
	}

	.input_min1 {
		width: 60pt;
	}

	button {
		border-radius: 5px;
		cursor: pointer;
	}
	.hidden{
		display: none;;
	}
	/** CMD黑框*/
	#scaleconsole{
		background-color: #0f0f0f;
		color: #FFFFFF;
		overflow: auto;
	}
	#scaleconsole #shanshuo {
		font-size: 20px;
		color: #00FF00;
		animation: blink 1s infinite;
	}
	@keyframes blink {
		0% { opacity: 0; }
		50% { opacity: 1; }
		100% { opacity: 0; }
	}
	/**必填项 */
	.sp_red{
		color: red;
		font-weight: bold;
	}


	table {
		mso-displayed-decimal-separator:"\.";
		mso-displayed-thousand-separator:"\,";
	}


	.xl6332418 {
		padding-top:1px;
		padding-right:1px;
		padding-left:1px;
		mso-ignore:padding;
		color:black;
		font-size:10.5pt;
		font-weight:400;
		font-style:normal;
		text-decoration:none;
		font-family:宋体;
		mso-generic-font-family:auto;
		mso-font-charset:134;
		mso-number-format:General;
		text-align:left;
		vertical-align:middle;
		mso-background-source:auto;
		mso-pattern:auto;
		white-space:nowrap;
	}
	.xl6432418 {
		padding-top:1px;
		padding-right:1px;
		padding-left:1px;
		mso-ignore:padding;
		color:black;
		font-size:11.0pt;
		font-weight:400;
		font-style:normal;
		text-decoration:none;
		font-family:等线;
		mso-generic-font-family:auto;
		mso-font-charset:134;
		mso-number-format:General;
		text-align:left;
		vertical-align:middle;
		mso-background-source:auto;
		mso-pattern:auto;
		white-space:nowrap;
	}



	.xl6832418 {
		padding-top:1px;
		padding-right:1px;
		padding-left:1px;
		mso-ignore:padding;
		color:black;
		font-size:11.0pt;
		font-weight:700;
		font-style:normal;
		text-decoration:none;
		font-family:宋体;
		mso-generic-font-family:auto;
		mso-font-charset:134;
		mso-number-format:General;
		text-align:center;
		vertical-align:middle;
		mso-background-source:auto;
		mso-pattern:auto;
		white-space:nowrap;
	}
	.xl6932418 {
		padding-top:1px;
		padding-right:1px;
		padding-left:1px;
		mso-ignore:padding;
		color:black;
		font-size:11.0pt;
		font-weight:400;
		font-style:normal;
		text-decoration:none;
		font-family:等线;
		mso-generic-font-family:auto;
		mso-font-charset:134;
		mso-number-format:General;
		text-align:center;
		vertical-align:middle;
		mso-background-source:auto;
		mso-pattern:auto;
		white-space:nowrap;
	}

	.xl7332418 {
		padding-top:1px;
		padding-right:1px;
		padding-left:1px;
		mso-ignore:padding;
		color:black;
		font-size:21.0pt;
		font-weight:700;
		font-style:normal;
		text-decoration:none;
		font-family:宋体;
		mso-generic-font-family:auto;
		mso-font-charset:134;
		mso-number-format:General;
		text-align:center;
		vertical-align:middle;
		border-top:none;
		border-right:none;
		border-bottom:1.5pt solid windowtext;
		border-left:none;
		mso-background-source:auto;
		mso-pattern:auto;
		white-space:nowrap;
	}

	.xl7532418 {
		padding-top:1px;
		padding-right:1px;
		padding-left:1px;
		mso-ignore:padding;
		color:black;
		font-size:10.5pt;
		font-weight:400;
		font-style:normal;
		text-decoration:none;
		font-family:宋体;
		mso-generic-font-family:auto;
		mso-font-charset:134;
		mso-number-format:General;
		text-align:center;
		vertical-align:middle;
		mso-background-source:auto;
		mso-pattern:auto;
		white-space:nowrap;
	}
	ruby {
		ruby-align:center;
	}
	rt {
		color:windowtext;
		font-size:9.0pt;
		font-weight:400;
		font-style:normal;
		text-decoration:none;
		font-family:等线;
		mso-generic-font-family:auto;
		mso-font-charset:134; mso-char-type:none;}
	</style>
</style>
<body style="background-color: white;">
<form class="layui-form" action=""  th:object="${Detection}">
    <div class="mainBox">
        <div class="main-container">
			<table  id="myTable" border=0 cellpadding=0 cellspacing=0 width=1021 style='border-collapse:
			collapse;table-layout:fixed;width:766pt'>
				<col width=64 span=6 style='width:48pt'>

				<tr height=20 style='height:15.0pt'>
					<td colspan=16 height=20 class=xl7332418 width=1021 style='height:15.0pt;
								width:766pt'>

						<input type="text" class="hidden" th:value="*{id}" name="id" lay-verify="title"
							   autocomplete="off" >
					</td>
				</tr>

				<tr height=18  style='mso-height-source:userset;height:18.8pt'>
					<td colspan=5 height=18 class=xl7532418 style='height:13.8pt'>
						<span class="sp_red">*&nbsp;</span>客户名称:
						<input th:value="*{customer}" type="text" id="customer" name="customer" style='mso-spacerun:yes' />
					</td>
					<td colspan=6 class=xl6432418>
						型号规格／测量范围:
						<input th:value="*{modelspecifications}" type="text" id="modelspecifications"   name="modelspecifications" style='mso-spacerun:yes'/>
					</td>
					<td colspan=5 class=xl6432418>
						任务单号:
						<input th:value="*{taskno}" type="text" id="taskno"  name="taskno" style='mso-spacerun:yes'/>
					</td>
				</tr>
				<tr height=18 class="tr_height" style='mso-height-source:userset;height:24.8pt'>
					<td colspan=5 height=18 class=xl6332418 style='height:13.8pt'>
									<span style='mso-spacerun:yes'>
										&nbsp;
									</span>
						制造厂／商:
						<input id="manufacturer" th:value="*{manufacturer}" type="text" name="manufacturer" style='mso-spacerun:yes'/>
					</td>
					<td colspan=3 class=xl6432418>
						<span class="sp_red">*&nbsp;</span>准确度等级／MPE:
					</td>
					<td colspan=4 class=xl6432418>
						<div>
							<select name="mpe1" th:field="*{mpe1}" th:with="type=${@dict.getType('E2_F1_F2_M1')}">
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>

						</div>
					</td>
					<td colspan=5 class=xl6432418>
						出厂编号:
						<input id="exitnum"   th:value="*{exitnum}" type="text"  name="exitnum"  style='mso-spacerun:yes'/>
					</td>
				</tr>
				<tr height=19 class="tr_height" style='mso-height-source:userset;height:24.8pt'>
					<td colspan=5 height=19 class=xl6332418 style='height:14.4pt'>
									<span style='mso-spacerun:yes'>
										&nbsp;
									</span>
						主要标准器名称:
						<input id="mainstandard" th:value="*{mainstandard}" type="text" name="mainstandard" style='mso-spacerun:yes'/>
					</td>
					<td colspan=3 class=xl6432418>
									<span style='mso-spacerun:yes'>
										&nbsp;
									</span>
						测量范围:<input th:value="*{mrange}" type="text"  id="mrange"  name="mrange"  class="input_min" style='mso-spacerun:yes'/>
					</td>

					<td colspan=5 class=xl6432418>
						证书编号:
						<input id="certificateno" th:value="*{certificateno}" type="text"  name="certificateno" style='mso-spacerun:yes'/>
					</td>
				</tr>
				<tr height=19 class="tr_height" style='height:24.8pt'>
					<td colspan=2 height=19 class=xl6332418 style='height:14.4pt'>
						<span class="sp_red">*&nbsp;</span>标准砝码:
					</td>
					</td>
					<td colspan=4 class=xl6932418>
						<div>

							<select name="smw" th:field="*{smw}" th:with="type=${@dict.getType('fmcode')}">
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>

						</div>
					</td>
					<td colspan=4 class=xl6432418>
						证书有效期至:
						<input id="certificateutil"  type="text" th:value="*{certificateutil}"  name="certificateutil"   style='mso-spacerun:yes'placeholder="202X-XX-XX" />
					</td>
				</tr>
				<tr height=19 class="tr_height" style='height:24.8pt'>
					<td height=19 class=xl6332418 colspan=3 style='height:14.4pt'>
									<span style='mso-spacerun:yes'>
										&nbsp;
									</span>
						检定的环境条件:
					</td>
					<td colspan=2 class=xl6432418>
						温度:
						<input id="temperature" th:value="*{temperature}" type="text"   name="temperature" class="input_min1" style='mso-spacerun:yes' placeholder="℃" />
					</td>
					<td colspan=2 class=xl6932418>
						湿度:
						<input id="humidity"  name="humidity"  th:value="*{humidity}" type="text"  class="input_min1" style='mso-spacerun:yes' placeholder="%RH" />
					</td>
					<td colspan=3 class=xl6432418>
						大气压力:
						<input  id="atmospheric" name="atmospheric"  th:value="*{atmospheric}" type="text"  class="input_min1"  style='mso-spacerun:yes' placeholder="hPa" />
					</td>
					<td colspan=3 class=xl6932418>
						空气密度:
						<input id="airdensity" name="airdensity"   th:value="*{airdensity}" type="text"  class="input_min1" style='mso-spacerun:yes' placeholder="mg/cm³" />
					</td>
					<td colspan=3 class=xl6432418>
						材料:
						<input id="stuff"  name="stuff" th:value="*{stuff}" type="text" class="input_min" style='mso-spacerun:yes' />
					</td>
				</tr>
				<tr height=19 class="tr_height" style='height:24.8pt'>
					<td colspan=7 height=19 class=xl6332418 style='height:14.4pt'>
							<span style='mso-spacerun:yes'>
										&nbsp;
									</span>
						检定依据的技术文件:
						<input id="according" th:value="*{according}" type="text"  class="input_max" name="according" value="JJG99-2022《砝码》检定规程"/>

					</td>
					<td colspan=5 class=xl6432418>
						计量标准使用前工作状况:
						<input class="input_min" id="prework"  th:value="*{prework}" type="text" name="prework" style='mso-spacerun:yes'/>
					</td>
					<td colspan=4 class=xl6432418>
						计量标准使用后工作状况:
						<input class="input_min" id="afterwork"  th:value="*{afterwork}" type="text" name="afterwork" style='mso-spacerun:yes'/>
					</td>
				</tr>
				<tr height=19 class="tr_height" style='height:24.8pt'>
					<td colspan=11 height=19 class=xl6332418 style='height:14.4pt'>
							<span style='mso-spacerun:yes'>
										&nbsp;
									</span>
						检定项目:
						<input class="input_max" id="project"  th:value="*{project}" type="text"  name="project" style='mso-spacerun:yes'/>
					</td>
					<td colspan=6 class=xl6432418>
									<span style='mso-spacerun:yes'>
										</span>
						检定地点:
						<input  id="inspectionsite"  th:value="*{inspectionsite}" type="text" name="inspectionsite" class="input_max" value='甘肃省计量研究院11室' style='mso-spacerun:yes'/>


					</td>
				</tr>
				<tr height=20 style='height:15.0pt'>
					<td colspan=16 height=20 class=xl6832418 style='height:15.0pt'>
					</td>
				</tr>

				<!-- --------------------------------------------------------------------------------------------------------------------------- -->
				<tr name="tab_header_one" class="tab_header " height=18 style='mso-height-source:userset;height:13.2pt'>
					<td rowspan=2 height=57 class=xl6532418 width=64 style='height:42.6pt;
								border-top:none;width:48pt'>
						检定顺序
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						名义质量（kg）
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						秤盘
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						读数1（mg）
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						读数2（mg）
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						平衡位置
					</td>
					<td rowspan=2 class=xl6532418 width=61 style='border-top:none;width:46pt'>
						分度值（mg）
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						相差质量（mg）
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						标准砝码约定质量修正值（mg）
					</td>
					<td rowspan=2 class=xl6532418 width=64 style='border-top:none;width:48pt'>
						空气浮力修正（mg）
					</td>
					<td colspan=2 class=xl6532418 width=128 style='border-left:none;width:96pt'>
						约定质量（mg）
					</td>
					<td colspan=2 class=xl6532418 width=128 style='border-left:none;width:96pt'>
						磁化率
					</td>
					<td colspan=2 class=xl6532418 width=128 style='border-left:none;width:96pt'>
						极化强度（μΤ）
					</td>
				</tr>
				<tr name="tab_header_two"  class="tab_header " height=39 style='height:29.4pt'>
					<input  id="read1" name="read1"  class="hidden" readonly />
					<input  id="read2" name="read2"  class="hidden" readonly />
					<input  id="mpe" name="mpe"  class="hidden" readonly />
					<td height=39 class=xl6532418 width=64 style='height:29.4pt;border-top:none;
								border-left:none;width:48pt'>
						修正值
					</td>
					<td class=xl6532418 width=64 style='border-top:none;border-left:none;
								width:48pt'>
						允差（±）
					</td>
					<td class=xl6532418 width=64 style='border-top:none;border-left:none;
								width:48pt'>
						读数
					</td>
					<td class=xl6532418 width=64 style='border-top:none;border-left:none;
								width:48pt'>
						允差（±）
					</td>
					<td class=xl6532418 width=64 style='border-top:none;border-left:none;
								width:48pt'>
						读数
					</td>
					<td class=xl6532418 width=64 style='border-top:none;border-left:none;
								width:48pt'>
						允差（±）
					</td>
				</tr>
				<!-- --------------------------------------------------------------------------------------------------------------------------- -->
				<tr name="tr_cmd" class="tr_cmd " height=19 style='height:45pt;'>
					<td colspan=16 height=19 class=xl7032418 width=1021 style='height:45pt;text-align:left;width:766pt'>
						<div class="mb-3" id="scaleconsole">
							<span id="scaleconsolespan"></span>
							<p id="shanshuo">--</p>
						</div>
					</td>
				</tr>
				<script>
					window.addEventListener('DOMContentLoaded', function () {
						const consoleDiv = document.getElementById('scaleconsole');
						consoleDiv.scrollTop = consoleDiv.scrollHeight;
					});

					// 如果是动态加载内容的情况，每次添加新内容后也需要滚动到底部
					function appendToConsole(newContent) {
						const newLine = document.createElement('p');
						//newLine.textContent = newContent;
						const colors = [
							'#00FF00'
						];
						let words = newContent.split(' ');
						for(let i = 0; i < words.length; i++) {
							let span = document.createElement('span');

							span.textContent = words[i]+' ';
							// 随机生成颜色
							const index = Math.floor(Math.random() * colors.length);
							let color = colors[index];
							span.style.color = color;
							newLine.appendChild(span);
						}

						document.getElementById('scaleconsolespan').appendChild(newLine);
						document.getElementById('scaleconsole').scrollTop = document.getElementById('scaleconsole').scrollHeight;
					}

				</script>
				<tr height=19 style='height:14.4pt'>
					<td colspan=16 height=19 class=xl7032418 width=1021 style='height:14.4pt;
								width:766pt'>
						　
					</td>
				</tr>



			</table>

        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit=""
                    lay-filter="scaletab-update">
                <i class="layui-icon layui-icon-ok"></i>
				提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
				重置
            </button>
        </div>
    </div>
	<script type="text/html" id="mpe1-type">


		{{#if (d.mpe1 == E2) { }}
		<span class="layui-badge layui-bg-default-blue">E2  ABBA测试2次</span>

		{{#if (d.mpe1 == F1) { }}
		<span class="layui-badge layui-bg-default-blue">F1  ABBA测一次</span>

		{{#if (d.mpe1 == F2) { }}
		<span class="layui-badge layui-bg-default-blue">F2  ABA测一次</span>

		{{#if (d.mpe1 == M1) { }}
		<span class="layui-badge layui-bg-default-blue">M1  ABA测一次</span>
		{{# } }}
	</script>
</form>
<th:block th:include="include :: footer"/>
<script>
    layui.use(['form','laydate','jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath+"/ScaletabController";


        form.on('submit(scaletab-update)', function (data) {
        	let loader = layer.load();
            $.ajax({
                url: MODULE_PATH+'/edit',
                data: data.field,
                dataType: 'json',
                contentType: 'application/x-www-form-urlencoded',
                type: 'post',
                success: function (result) {
                    if (result.code==200) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("scaletab-table");
                            layer.close(loader);
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                        layer.close(loader);
                    }
                }
            })
            return false;
        });


        //根据MPE1的值显示ABBA或ABA 模式
		const  MPE1 = document.getElementById('mpe1');;
		const selectedValue = MPE1.value;
		var url;
		// 根据不同的值决定请求的 URL
		if (selectedValue === 'E2'|| selectedValue==='F1') {
			url = "abba";
		} else if (selectedValue === 'F2'|| selectedValue==='M1') {
			url = "aba";
		} else {
			alert("MPE错误");
		}


		// 使用 fetch 发起请求
		$.get(url, function(data) {

					var $table = $('#myTable');
					var $insertBeforeRow = $table.find('tr:eq(12)');
					$($.parseHTML(data)).insertBefore($insertBeforeRow);
				});


    })
</script>
</body>
</html>